package net.xconcepts.stockdata.model.tests;

import static org.junit.Assert.assertTrue;
import net.xconcepts.stockdata.model.Portfolio;
import net.xconcepts.stockdata.model.analysis.symbol.Symbol;
import net.xconcepts.stockdata.model.analysis.symbol.SymbolFactory;

import org.junit.Test;

public class PortfolioTest {

	public Portfolio mPortfolio;
	
	public void setUp() {
		mPortfolio = new Portfolio();
	}
	
	@Test
	public void cashManipulation() {
		setUp();
		
		mPortfolio.addCash(100);		
		assertTrue(mPortfolio.getCash() == 100);
		
		mPortfolio.addCash(-50);
		assertTrue(mPortfolio.getCash() == 50);
	}
	
	@Test
	public void stockManipulation() {
		setUp();
		
		Symbol GOOG = SymbolFactory.getSymbol("GOOG");
		
		assertTrue(mPortfolio.getNumShares(GOOG) == 0);
		
		mPortfolio.addShares(GOOG, 100);
		assertTrue(mPortfolio.getNumShares(GOOG) == 100);
		
		mPortfolio.addShares(GOOG, -50);
		assertTrue(mPortfolio.getNumShares(GOOG) == 50);
	}


}
